package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.MarketCoupon;
import com.cskaoyan.bean.MarketCoupon2;
import com.cskaoyan.bean.MarketTopic;
import com.cskaoyan.model.admin.bo.MarketCouponBo;
import com.cskaoyan.model.admin.vo.AdReadTopicVo;
import com.cskaoyan.model.admin.vo.AdTopicReadVo;
import com.cskaoyan.model.admin.bo.ListBo;
import com.cskaoyan.model.admin.vo.AdBaseData;
import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.service.admin.AdService;
import com.cskaoyan.service.admin.CouponService;

import com.cskaoyan.service.admin.TopicService;
import com.cskaoyan.storagecreateproperties.Path;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;



@RestController
@RequestMapping("admin")
@Configuration
public class AdController {
//    /admin/ad/list?page=1&limit=20&sort=add_time&order=desc
//    @Value("${spring.mvc.static-path-pattern}")
//    String imgPattern;
//    @Value("${spring.web.resources.static-locations}")
//    String imgLocations;
//    @Value("${server.port}")
//    String port;
//    @Value("${ip}")
//    String ip;
    @Autowired
    Path path;
    @Autowired
    AdService adService;
    @Autowired
    CouponService couponService;
    @Autowired
    TopicService topicService;
//    @GetMapping("ad/list")
//    public BaseRespVo list(ListBo listBo){
//        AdBaseData baseData=adService.list(listBo);
//        return BaseRespVo.ok(baseData);
//    }
//    //{"name":"sdfasd","content":"sdfasd","url":"http://182.92.235.201:8083/wx/storage/fetch/9ofrn3f89ll3cosc3l31.JPG","link":"asdfa","position":1,"enabled":true}
//    //{"errno":0,"data":{"id":9,"name":"sdfsdfg","link":"gsdfgdfgh","url":"http://182.92.235.201:8083/wx/storage/fetch/4f7ffvgjan05hp10thn4.JPG","position":1,"content":"gdfgdf","enabled":true,"addTime":"2021-11-29 21:31:55","updateTime":"2021-11-29 21:31:55"},"errmsg":"成功"}
////    @PostMapping("ad/create")
////    public BaseRespVo create(@RequestBody MarketAd marketAd, MultipartFile file){
////        //AdCreateBo
////        String absolutePath = FileUploadBySpringUtils.uploadFile(file, "adCreateImg");
////        marketAd.setUrl(absolutePath.replace(imgLocations,""));
////
////        MarketAd marketAd1=adService.create(marketAd);
////
////        String url=ip+":"+port+imgPattern.replace("**","")+marketAd1.getUrl();
////        marketAd1.setUrl(url);
////
////        return BaseRespVo.ok(marketAd1);
//////
////    }
////    {"name":"sdfsd","content":"sdfsd","url":"http://182.92.235.201:8083/wx/storage/fetch/ll1pwowhn738t9zl29hw.JPG","link":"dsfsd","position":1,"enabled":true}
//    //{"errno":0,"data":{"id":15,"name":"sdfsd","link":"dsfsd","url":"http://182.92.235.201:8083/wx/storage/fetch/ll1pwowhn738t9zl29hw.JPG","position":1,"content":"sdfsd","enabled":true,"addTime":"2021-11-29 23:05:47","updateTime":"2021-11-29 23:05:47"},"errmsg":"成功"}
////    @PostMapping("ad/create")
////    public BaseRespVo create(@RequestBody MarketAd marketAd){
////        MarketAd marketAd1=adService.create(marketAd);
////
////        return BaseRespVo.ok(marketAd1);
//////
////    }
//    //{"id":8,"name":"htfghfg","link":"fdgdf","url":"http://182.92.235.201:8083/wx/storage/fetch/9ofrn3f89ll3cosc3l31.JPG","position":1,"content":"ereytt","enabled":true,"addTime":"2021-11-29 21:01:35","updateTime":"2021-11-29 21:01:35"}
//    //{"errno":0,"data":{"id":9,"name":"sdfsdfg","link":"dfbdfg","url":"http://182.92.235.201:8083/wx/storage/fetch/4f7ffvgjan05hp10thn4.JPG","position":1,"content":"gdfgdf","enabled":true,"addTime":"2021-11-29 21:31:55","updateTime":"2021-11-29 21:37:27"},"errmsg":"成功"}
//    @PostMapping("ad/update")
//    public BaseRespVo update(@RequestBody MarketAd marketAd){
//        //AdUpdateBo
//        MarketAd marketAd1=adService.update(marketAd);
//        return BaseRespVo.ok(marketAd1);
//    }
//    //{"id":8,"name":"htfghfg","link":"fdgdf","url":"http://182.92.235.201:8083/wx/storage/fetch/9ofrn3f89ll3cosc3l31.JPG","position":1,"content":"ereytt","enabled":true,"addTime":"2021-11-29 21:01:35","updateTime":"2021-11-29 21:01:35"}
//    //{"errno":0,"errmsg":"成功"}
//    @PostMapping("ad/delete")
//    public BaseRespVo delete(@RequestBody MarketAd marketAd){
//        //AdDeleteBo
//        MarketAd marketAd1=adService.delete(marketAd);
//                return BaseRespVo.ok(null);
//    }
    //page=1&limit=20&sort=add_time&order=desc
    //{"errno":0,"data":{"total":5,"pages":1,"limit":20,"page":1,"list":[{"id":10,"name":"efrger","desc":"efgerg","tag":"erge","total":56,"discount":5.00,"min":3.00,"limit":1,"type":0,"status":0,"goodsType":0,"goodsValue":[],"timeType":0,"days":45,"addTime":"2021-11-29 21:17:58","updateTime":"2021-11-29 21:17:58","deleted":false},{"id":8,"name":"可兑换优惠券","desc":"全场通用","tag":"仅兑换领券","total":0,"discount":15.00,"min":99.00,"limit":1,"type":2,"status":0,"goodsType":0,"goodsValue":[],"code":"DC6FF8SE","timeType":0,"days":7,"addTime":"2018-12-23 09:29:57","updateTime":"2018-12-23 09:29:57","deleted":false},{"id":1,"name":"限时满减券","desc":"全场通用","tag":"无限制","total":0,"discount":5.00,"min":99.00,"limit":1,"type":0,"status":0,"goodsType":0,"goodsValue":[],"timeType":0,"days":10,"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false},{"id":2,"name":"限时满减券","desc":"全场通用","tag":"无限制","total":0,"discount":10.00,"min":99.00,"limit":1,"type":0,"status":0,"goodsType":0,"goodsValue":[],"timeType":0,"days":10,"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false},{"id":3,"name":"新用户优惠券","desc":"全场通用","tag":"无限制","total":0,"discount":10.00,"min":99.00,"limit":1,"type":1,"status":0,"goodsType":0,"goodsValue":[],"timeType":0,"days":10,"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false}]},"errmsg":"成功"}
    @GetMapping("coupon/list")
    public BaseRespVo couponList(ListBo listBo,MarketCoupon marketCoupon){
        AdBaseData adBaseData=couponService.list(listBo,marketCoupon);
//        AdCouponListBo
        return BaseRespVo.ok(adBaseData);
    }
    //{"name":"efrger","desc":"efgerg","tag":"erge","total":"56","discount":"5","min":"3","limit":1,"type":0,"status":0,"goodsType":0,"goodsValue":[],"timeType":0,"days":"45","startTime":null,"endTime":null}
    //{"errno":0,"data":{"id":11,"name":"dfgsd","desc":"sdfsd","tag":"sdfgsdf","total":4564,"discount":56,"min":34,"limit":1,"type":0,"status":0,"goodsType":2,"goodsValue":[],"timeType":0,"days":45,"addTime":"2021-11-29 21:39:37","updateTime":"2021-11-29 21:39:37"},"errmsg":"成功"}
    @PostMapping("coupon/create")
    public BaseRespVo create(@RequestBody MarketCouponBo marketCouponBo){
        MarketCoupon marketCoupon1=couponService.create(marketCouponBo);
                return BaseRespVo.ok(marketCoupon1);
    }
    public Date StringToDate(String string) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
        Date parse = null;
        try {
            parse = simpleDateFormat.parse(string);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return parse;
    }
    //{"id":11,"name":"dfgsd","desc":"sdfsd","tag":"sdfgsdf","total":"45","discount":56,"min":34,"limit":1,"type":0,"status":0,"goodsType":2,"goodsValue":[],"timeType":0,"days":45,"addTime":"2021-11-29 21:39:37","updateTime":"2021-11-29 21:39:37","daysType":0}
    //{"errno":0,"data":{"id":11,"name":"dfgsd","desc":"sdfsd","tag":"sdfgsdf","total":45,"discount":56,"min":34,"limit":1,"type":0,"status":0,"goodsType":2,"goodsValue":[],"timeType":0,"days":45,"addTime":"2021-11-29 21:39:37","updateTime":"2021-11-29 21:40:43"},"errmsg":"成功"}
    @PostMapping("coupon/update")
    public BaseRespVo update(@RequestBody MarketCoupon2 marketCoupon2){
//        AdCouponUpdateBo
        MarketCoupon marketCoupon1=couponService.update(marketCoupon2);
                return BaseRespVo.ok(marketCoupon1);
    }
    //{"id":11,"name":"dfgsd","desc":"sdfsd","tag":"sdfgsdf","total":"45","discount":56,"min":34,"limit":1,"type":0,"status":0,"goodsType":2,"goodsValue":[],"timeType":0,"days":45,"addTime":"2021-11-29 21:39:37","updateTime":"2021-11-29 21:39:37","daysType":0}
    //{"errno":0,"errmsg":"成功"}
    @PostMapping("coupon/delete")
    public BaseRespVo delete(@RequestBody MarketCoupon marketCoupon){
//        AdCouponDeleteBo
        Integer rows=couponService.delete(marketCoupon);
                return BaseRespVo.ok(null);
    }
//    page=1&limit=20&couponId=10&sort=add_time&order=desc
    //{"errno":0,"data":{"total":0,"pages":0,"limit":20,"page":0,"list":[]},"errmsg":"成功"}
    @GetMapping("coupon/listuser")
    public BaseRespVo listuser(ListBo listBo,String couponId){
//        AdCouponListuserBo
        AdBaseData adBaseData =couponService.listuser(listBo,couponId);
                return BaseRespVo.ok(adBaseData);
    }
    @GetMapping("coupon/read")
    public BaseRespVo couponRead(Integer id){
        MarketCoupon marketCoupon=couponService.couponRead(id);
        return BaseRespVo.ok(marketCoupon);
    }
    //page=1&limit=20&sort=add_time&order=desc
    //{"errno":0,"data":{"total":20,"pages":1,"limit":20,"page":1,"list":[{"id":264,"title":"设计师们推荐的应季好物","subtitle":"原创设计春款系列上新","price":29.90,"readCount":"77.7k","picUrl":"https://yanxuan.nosdn.127.net/14918201901050274.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":266,"title":"一条丝巾就能提升时髦度","subtitle":"不知道大家对去年G20时，严选与国礼制造商一起推出的《凤凰于飞》等几款丝巾是否还...","price":0.00,"readCount":"35.0k","picUrl":"https://yanxuan.nosdn.127.net/14919007135160213.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":268,"title":"米饭好吃的秘诀：会呼吸的锅","subtitle":"今年1月份，我们联系到了日本伊贺地区的长谷园，那里有着180年伊贺烧历史的窑厂。...","price":0.00,"readCount":"33.3k","picUrl":"https://yanxuan.nosdn.127.net/14920623353130483.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":271,"title":"选式新懒人","subtitle":"懒出格调，懒出好生活。","price":15.00,"readCount":"57.7k","picUrl":"https://yanxuan.nosdn.127.net/14924199099661697.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":272,"title":"料理也要精细简单","subtitle":"享受天然的味道，日子每天都好新鲜","price":69.00,"readCount":"125.6k","picUrl":"https://yanxuan.nosdn.127.net/14925200530030186.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":274,"title":"没有软木拖，怎么过夏天","subtitle":"刚入四月，杭州的气温就已升高至30度。店庆时买了软木拖的用户，陆续发回评价说，很...","price":0.00,"readCount":"46.4k","picUrl":"https://yanxuan.nosdn.127.net/14925822213780237.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":277,"title":"治愈生活的满怀柔软","subtitle":"太鼓抱枕的上架历程，是从失踪开始的。由于表面的绒感，最初它被安排在秋冬季上架。某...","price":0.00,"readCount":"19.6k","picUrl":"https://yanxuan.nosdn.127.net/14926737925770587.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":281,"title":"条纹新风尚","subtitle":"经典百搭，时尚线条","price":29.00,"readCount":"76.5k","picUrl":"https://yanxuan.nosdn.127.net/14926859849200826.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":282,"title":"成就一室笋香","subtitle":"三石哥办公室常备小食推荐","price":12.00,"readCount":"40.9k","picUrl":"https://yanxuan.nosdn.127.net/14927695046601069.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":283,"title":"孩子成长中少不了的一双鞋","subtitle":"说起毛毛虫鞋，好处实在太多了，作为一个2岁孩子的宝妈选品员，按捺不住想告诉大家，...","price":0.00,"readCount":"42.5k","picUrl":"https://yanxuan.nosdn.127.net/14927748974441080.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":286,"title":"无“油”无虑的甜蜜酥脆","subtitle":"大家都知道，饮食组是严选体重最重的一组，基本上每个新人都能在一个月之内迅速长胖。...","price":0.00,"readCount":"15.6k","picUrl":"https://yanxuan.nosdn.127.net/14931121822100127.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":287,"title":"严选新式样板间","subtitle":"一种软装一个家","price":29.90,"readCount":"55.6k","picUrl":"https://yanxuan.nosdn.127.net/14931970965550315.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":289,"title":"专业运动袜也可以高性价比","subtitle":"越来越多运动人士意识到，运动鞋要购置好的，鞋里的运动袜也不可忽视。专业运动袜帮助...","price":0.00,"readCount":"11.9k","picUrl":"https://yanxuan.nosdn.127.net/14932840600970609.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":291,"title":"舒适新主张","subtitle":"如何挑选适合自己的好物？","price":29.00,"readCount":"67.8k","picUrl":"https://yanxuan.nosdn.127.net/14939496197300723.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":294,"title":"这只锅，可以从祖母用到孙辈","subtitle":"买100年传世珐琅锅送迷你马卡龙色小锅","price":149.00,"readCount":"108.1k","picUrl":"https://yanxuan.nosdn.127.net/14937214454750141.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":295,"title":"他们在严选遇见的新生活","subtitle":"多款商品直减中，最高直减400元","price":35.80,"readCount":"36.6k","picUrl":"https://yanxuan.nosdn.127.net/14938092956370380.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":299,"title":"买过的人都说它是差旅神器","subtitle":"许多人经历过旅途中内裤洗晾不便的烦恼，尤其与旅伴同居一室时，晾在卫生间里的内裤更...","price":0.00,"readCount":"28.7k","picUrl":"https://yanxuan.nosdn.127.net/14938873919030679.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":300,"title":"秒杀化学洗涤剂的纯天然皂","subtitle":"前段时间有朋友跟我抱怨，和婆婆住到一起才发现生活理念有太多不和。别的不提，光是洗...","price":0.00,"readCount":"15.3k","picUrl":"https://yanxuan.nosdn.127.net/14939843143621089.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":313,"title":"一次解决5个节日送礼难题","subtitle":"这些就是他们想要的礼物清单","price":59.90,"readCount":"7.8k","picUrl":"https://yanxuan.nosdn.127.net/14942996754171334.jpg","sortOrder":0,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"},{"id":314,"title":"关爱他成长的每一个足迹","subtitle":"专业运动品牌同厂，毛毛虫鞋买二送一","price":0.00,"readCount":"6.4k","picUrl":"https://yanxuan.nosdn.127.net/14943267735961674.jpg","sortOrder":1,"goods":[],"addTime":"2018-02-01 00:00:00","updateTime":"2018-02-01 00:00:00","deleted":false,"content":"<img src=\"//yanxuan.nosdn.127.net/75c55a13fde5eb2bc2dd6813b4c565cc.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/e27e1de2b271a28a21c10213b9df7e95.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/9d413d1d28f753cb19096b533d53418d.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/64b0f2f350969e9818a3b6c43c217325.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/a668e6ae7f1fa45565c1eac221787570.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/0d4004e19728f2707f08f4be79bbc774.jpg\">\n    <img src=\"//yanxuan.nosdn.127.net/79ee021bbe97de7ecda691de6787241f.jpg\">"}]},"errmsg":"成功"}
    @GetMapping("topic/list")
    public BaseRespVo topicList(ListBo listBo,MarketTopic marketTopic){
//        AdTopicListBo
        AdBaseData adBaseData=topicService.list(listBo,marketTopic);
                return BaseRespVo.ok(adBaseData);
    }
    //{"goods":[],"title":"sdfsdfs","subtitle":"werwer","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/51pw349ax8o9qym6ybl8.JPG","content":"<p>sdfsdfsdfsdfgdfgdf</p>","price":"123","readCount":"12341"}
    //{"errno":0,"data":{"id":315,"title":"sdfsdfs","subtitle":"werwer","price":123,"readCount":"12341","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/51pw349ax8o9qym6ybl8.JPG","goods":[],"addTime":"2021-11-29 21:45:42","updateTime":"2021-11-29 21:45:42","content":"<p>sdfsdfsdfsdfgdfgdf</p>"},"errmsg":"成功"}
    @PostMapping("topic/create")
    public BaseRespVo create(@RequestBody MarketTopic marketTopic){
//        AdTopicBo
        MarketTopic marketTopic1=topicService.create(marketTopic);
                return BaseRespVo.ok(marketTopic);
    }
    //{"id":315,"title":"sdfsdfs","subtitle":"werthr","price":123,"readCount":"12341","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/51pw349ax8o9qym6ybl8.JPG","sortOrder":100,"goods":[],"addTime":"2021-11-29 21:45:43","updateTime":"2021-11-29 21:45:43","deleted":false,"content":"<p>sdfsdfsdfsdfgdfgdf</p>"}
    //{"errno":0,"data":{"id":315,"title":"sdfsdfs","subtitle":"werthr","price":123,"readCount":"12341","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/51pw349ax8o9qym6ybl8.JPG","sortOrder":100,"goods":[],"addTime":"2021-11-29 21:45:43","updateTime":"2021-11-29 21:46:41","deleted":false,"content":"<p>sdfsdfsdfsdfgdfgdf</p>"},"errmsg":"成功"}
    @PostMapping("topic/update")
    public BaseRespVo update(@RequestBody MarketTopic marketTopic){
//        AdTopicUpdateBo
        MarketTopic marketTopic1=topicService.update(marketTopic);

                return BaseRespVo.ok(marketTopic1);
    }

    @GetMapping("topic/read")
    public BaseRespVo topicRead(Integer id){

        AdReadTopicVo adReadTopicVo=topicService.topicRead(id);
        return BaseRespVo.ok(adReadTopicVo);
    }
    //{"id":315,"title":"sdfsdfs","subtitle":"werthr","price":123,"readCount":"12341","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/51pw349ax8o9qym6ybl8.JPG","sortOrder":100,"goods":[],"addTime":"2021-11-29 21:45:43","updateTime":"2021-11-29 21:46:42","deleted":false,"content":"<p>sdfsdfsdfsdfgdfgdf</p>"}
    //{"errno":0,"errmsg":"成功"}


    @PostMapping("topic/delete")
    public BaseRespVo delete(@RequestBody MarketTopic marketTopic){
//        AdTopicDeleteBo
        Integer rows=topicService.delete(marketTopic);
                return BaseRespVo.ok(null);
    }
    @PostMapping("topic/batch-delete")
    public BaseRespVo batchDelete(@RequestBody Map<Object,Integer[]> map){
        int i=topicService.batchDelete(map);
        return BaseRespVo.ok(null);
    }
//    @PostMapping("storage/create")
//    public BaseRespVo storageCreate(@RequestBody MultipartFile file){
////        AdTopicDeleteBo
////        String location=path.setLocation();//磁盘没问题用这个
//        String location= "file:E:/spring/";
//        String basepath = location.replace("file:", "");
//        MarketStorage marketStorage = new MarketStorage();
//        String absolutePath = FileUploadBySpringUtils.uploadFile(file, "storageCreateImg",basepath);
//        String replace = absolutePath.replace(basepath, "");
//        marketStorage.setUrl(replace);
//        marketStorage.setAddTime(new Date());
//        marketStorage.setDeleted(false);
//        marketStorage.setKey(file.);
//        marketStorage.setName(file.getOriginalFilename());
//        marketStorage.setType(file.getContentType());
//        marketStorage.setSize((int)file.getSize());
//
//        MarketStorage marketStorage1=marketStorageService2.create(marketStorage);
//
//        String beforePattern=path.getPattern();
//        String replacePattern="";
//        for(int i=0;i<beforePattern.length();i++){
//            if(beforePattern.charAt(i)!='*'){
//                replacePattern+=beforePattern.charAt(i);
//            }
//        }
//
//        String url=path.getIp()+":"+path.getPort()+replacePattern+marketStorage1.getUrl();
//        marketStorage1.setUrl(url);
//
//        return BaseRespVo.ok(marketStorage1);
//    }
}
